
/**
 * Category model
 *
 * @author glory.xu
 */

import { Application } from 'egg';

export default function(app: Application) {
  const { STRING, INTEGER } = app.Sequelize;

  const Category = app.model.define('category', {
    id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true,
    },
    name: STRING(20),
    sortIndex: INTEGER,
  }, {
    createdAt: false,
    updatedAt: false,
    freezeTableName: true,
    tableName: 'category',
  });

  return class extends Category {};
}
